import axios from 'axios'
import api from "./server-api";

var _url = api.ip
// var _url = 'http://47.107.159.133:80'

const cartList = (callback) => {
  const url = _url + '/cart/?page=1&limit=5&userId=1'
  axios.get(url).then(num => {
    callback && callback(num.data)
  })
}

//分页
const pagingList = (val,callback) => {
  const url = _url + '/cart/?page='+val+'&limit=5&userId=1'
  axios.get(url).then(num => {
    callback && callback(num.data)
  })
}

const cartCount = (callback) => {
  const url = _url + '/cart/count?userId=1'
  axios.get(url).then(num => {
    callback && callback(num)
  })
}

export {
  cartList, // 自动刷新 只查十条数据
  cartCount, // 数据总条数
  pagingList, //分页功能
}
